import App from './App'
import store from './store/index'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
Vue.prototype.$store = store
App.mpType = 'app'
const app = new Vue({
	...App,
	store,
})
app.$mount()
// #endif

uni.$u.config.unit = 'rpx'


// 全局引入uView
import uView from '@/uni_modules/uview-ui'
import UniQrcode from 'uniapp-qrcode'
Vue.use(uView)

//这里是封装的权限系统
import btnPermission from './directive/permission.js';
Vue.prototype.$has = btnPermission;

//登录判断
import login from '@/utils/login.js'
Vue.prototype.$login = login;
//重载uni.showToast，简化调用
Vue.prototype.$showToast = function(title, duration = 4000, icon = "none") {
	return uni.showToast({
		title,
		duration,
		icon
	})
}
//重载uni.showModal，简化调用
Vue.prototype.$showModal = function(content) {
	return uni.showModal({
		title:'温馨提示',
		content,
		showCancel:false,
		confirmText: '确定',
		confirmColor: '#007A69'
	})
}

//引入埋点
//import '@/utils/burialPoint.js'
//全局属性
//import getSystemInfo from '@/utils/getSystemInfo.js'
//Vue.mixin(getSystemInfo)
import nav from "@/utils/navRoute.js";
Vue.prototype.$navTo = nav;


import apis from './http/index.js'
Vue.prototype.$api = apis;
//日期格式处理
import dateFormat from '@/utils/dateFormat.js'
Vue.use(dateFormat);
//微信支付
import wxPay from '@/utils/wxPay.js'
Vue.prototype.$wxPay = wxPay;
//订单状态字典
import ocfg from '@/utils/orderStatus.js'
Vue.prototype.$ocfg = ocfg;

// 渔家乐订单状态字典
// FishJialeOrder
import FishJialeOcfg from '@/utils/FishJialeOrder.js'
Vue.prototype.$FishJialeOcfg = FishJialeOcfg;

//舱位图片
import cabinImgConfig from '@/utils/cabinImg.js'
Vue.prototype.$cic = cabinImgConfig;
// 全局注册自定义头部 白色
import customNavBar from './compoments/uNavBar/index.vue'
Vue.component('c-nav-bar', customNavBar);

// 全局注册自定义头部  绿色
import customNavBar1 from './compoments/uNavBar/index1.vue'
Vue.component('c-nav-bar1', customNavBar1);

// // 全局注册自定义头部
// import customNavBar1 from './compoments/uNavBar1'
// Vue.component('customNavBar1', customNavBar1);

//全局分享当前页(带参数)
import wxShare from '@/utils/wxShare.js'
Vue.mixin(wxShare);
Vue.prototype.$path = '';

//解决navigateTo超过十层无法跳转问题(需要配合自定义头部组件使用)
uni.navigateTo = function navigateTo(options) {
	let pages = getCurrentPages();
	let opt = pages[pages.length - 1].options;
	if (pages.length > 9) {
		let url = '/' + pages[pages.length - 1].route;
		if (JSON.stringify(opt) != '{}') {
			let i = 0;
			for (let o in opt) {
				url += (i == 0 ? '?' : '&') + o + '=' + opt[o];
				i++;
			}
		}
		uni.setStorageSync('options', encodeURIComponent(JSON.stringify({
			url
		})));
		wx.redirectTo(options);
	} else {
		uni.removeStorageSync('options');
		wx.navigateTo(options);
	}
}

import NoData from './compoments/NoData'
Vue.component('NoData', NoData);

//引入正则校验
import regTest from './utils/reg.js'
Vue.prototype.$reg = regTest;

// 浏览记录
import browsingHistory from '@/utils/browsingHistory.js'
Vue.mixin(browsingHistory);

//加解密和脱敏
import aesTm from '@/utils/aes.js'
Vue.prototype.$aesTm = aesTm;

//乘客证件类型
import userCredentialsType from '@/utils/userCredentialsType.js'
Vue.prototype.$uct = userCredentialsType;

// 倒计时(待支付)
import uCountDown from './compoments/countDown/index.vue'
Vue.component('uCountDown', uCountDown);
Vue.prototype.$gqTime = 15 * 60 * 1000;//订单过期时长

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif